import request from '@/utils/request'

export function getSalary(data, offset, limit) {
  return request({
    url: '/salary',
    method: 'get',
    params: {
      userId: data.userId,
      offset: offset,
      limit: limit
    }
  })
}

export function getMySalary() {
  return request({
    url: '/salary/mine',
    method: 'get'
  })
}

export function getSalaryLog() {
  return request({
    url: '/salary/log',
    method: 'get'
  })
}

export function addSalary(data) {
  return request({
    url: '/salary',
    method: 'post',
    data
  })
}

export function modifySalary(id, data) {
  return request({
    url: `/salary/${id}`,
    method: 'put',
    data
  })
}


export function deleteSalary(id, status) {
  return request({
    url: `/salary/status/${id}?status=${status}`,
    method: 'put'
  })
}

// 结算工资
export function calculateSalary() {
  return request({
    url: `/salary/calculate`,
    method: 'post'
  })
}
